/**
 * Universidad del Valle de Guatemala
 * Algoritmos y estructura de Datos.
 * @autor Evelyn Lissete Paiz   11365
 * Sección: 20
 * 08 de julio, 2012
 * Programa que permite utilizar el radio por medio de una GUI.
 */

package hoja_uno;

import hoja_uno.otros_grupos.*;
import java.awt.BorderLayout;
import javax.swing.JOptionPane;

public class RadioGUI extends javax.swing.JFrame {

    //------------------------------------------------------------------------
    // Constructor:
    //------------------------------------------------------------------------
    
    /**
     * Método que permite la cración de una nueva interfaz para el radio.
     */
    public RadioGUI() {
        initComponents();
        //Se coloca el fondo de la ventana.
        Fondo fondo = new Fondo (423,542,"ipadFondo.jpg");
        this.add(fondo,BorderLayout.CENTER);
        this.pack();
        //Se crea el radio.
        radio = new Uso_Radio();
        //Se coloca la información en la pantalla.
        this.info.setText(this.mostInf());
        this.guardar.setSelected(true);
    }

    //------------------------------------------------------------------------
    // Métodos: 
    //------------------------------------------------------------------------
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        on_off = new javax.swing.JButton();
        am_fm = new javax.swing.JButton();
        masBanda = new javax.swing.JButton();
        uno = new javax.swing.JButton();
        dos = new javax.swing.JButton();
        cuatro = new javax.swing.JButton();
        cinco = new javax.swing.JButton();
        tres = new javax.swing.JButton();
        seis = new javax.swing.JButton();
        siete = new javax.swing.JButton();
        ocho = new javax.swing.JButton();
        nueve = new javax.swing.JButton();
        diez = new javax.swing.JButton();
        once = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        guardar = new javax.swing.JRadioButton();
        seleccionar = new javax.swing.JRadioButton();
        frecuencia = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        info = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        on_off.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        on_off.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/On.png"))); // NOI18N
        on_off.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                on_offActionPerformed(evt);
            }
        });

        am_fm.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        am_fm.setText("AM/FM");
        am_fm.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                am_fmActionPerformed(evt);
            }
        });

        masBanda.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        masBanda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/arriba.png"))); // NOI18N
        masBanda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                masBandaActionPerformed(evt);
            }
        });

        uno.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        uno.setText("1");
        uno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                unoActionPerformed(evt);
            }
        });

        dos.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        dos.setText("2");
        dos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dosActionPerformed(evt);
            }
        });

        cuatro.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        cuatro.setText("4");
        cuatro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cuatroActionPerformed(evt);
            }
        });

        cinco.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        cinco.setText("5");
        cinco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cincoActionPerformed(evt);
            }
        });

        tres.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        tres.setText("3");
        tres.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tresActionPerformed(evt);
            }
        });

        seis.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        seis.setText("6");
        seis.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                seisActionPerformed(evt);
            }
        });

        siete.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        siete.setText("7");
        siete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sieteActionPerformed(evt);
            }
        });

        ocho.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        ocho.setText("8");
        ocho.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ochoActionPerformed(evt);
            }
        });

        nueve.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        nueve.setText("9");
        nueve.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nueveActionPerformed(evt);
            }
        });

        diez.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        diez.setText("10");
        diez.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                diezActionPerformed(evt);
            }
        });

        once.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        once.setText("11");
        once.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                onceActionPerformed(evt);
            }
        });

        jButton1.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        jButton1.setText("12");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        guardar.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        guardar.setText("Guardar");
        guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                guardarActionPerformed(evt);
            }
        });

        seleccionar.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        seleccionar.setText("Seleccionar");
        seleccionar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                seleccionarActionPerformed(evt);
            }
        });

        frecuencia.setFont(new java.awt.Font("Tw Cen MT", 0, 14));
        frecuencia.setText("Frecuencia:");

        info.setColumns(20);
        info.setRows(5);
        info.setEnabled(false);
        jScrollPane1.setViewportView(info);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(62, 62, 62)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(nueve, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
                                    .addComponent(cinco, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(uno, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(5, 5, 5)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(dos, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(diez, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(seis, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(once, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(siete, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(tres, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(ocho, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cuatro, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(58, 58, 58))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(57, 57, 57))
            .addGroup(layout.createSequentialGroup()
                .addGap(80, 80, 80)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(masBanda)
                        .addGap(31, 31, 31)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(seleccionar)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(on_off))
                            .addComponent(guardar)
                            .addComponent(am_fm)))
                    .addComponent(frecuencia))
                .addContainerGap(87, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(84, 84, 84)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(uno)
                    .addComponent(dos)
                    .addComponent(tres)
                    .addComponent(cuatro))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cinco)
                    .addComponent(ocho)
                    .addComponent(siete)
                    .addComponent(seis))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nueve)
                    .addComponent(diez)
                    .addComponent(once)
                    .addComponent(jButton1))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(frecuencia)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(masBanda)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(guardar)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(on_off)
                                    .addComponent(seleccionar)))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(84, 84, 84)
                        .addComponent(am_fm)))
                .addContainerGap(135, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Método que muestra en la pantalla del radio la información de este.
     * @return La información del radio
     */
    private String mostInf (){
        if (radio.isOn()==false){
            return "El radio está apagado";
        }
        else{
            if (radio.isFM()==true){
                return "El radio está encendido \n FM " + radio.getFrecuencia();
            }
            else{
                return "El radio está encendido \n AM " + radio.getFrecuencia();
            }
        }
    }
    
    /**
     * Método que permite guardar una estación en el botón 8 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void ochoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ochoActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(8);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(8);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_ochoActionPerformed

    /**
     * Método que permite encender o apagar el radio.
     * @param evt El evento que se da al oprimir el botón. 
     */
    private void on_offActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_on_offActionPerformed
        this.radio.onOff();
        this.info.setText(this.mostInf());
    }//GEN-LAST:event_on_offActionPerformed

    /**
     * Método que permite cambiar de banda en el radio. De AM-FM y de
     * FM-AM.
     * @param evt El evento que se da al oprimir el botón. 
     */
    private void am_fmActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_am_fmActionPerformed
        this.radio.cambiarBanda();
        this.info.setText(this.mostInf());
    }//GEN-LAST:event_am_fmActionPerformed

    /**
     * Método que permite guardar una estación en el botón 1 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void unoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unoActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(1);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(1);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_unoActionPerformed
    
    /**
     * Método que permite guardar una estación en el botón 2 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void dosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dosActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(2);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(2);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_dosActionPerformed

    /**
     * Método que permite guardar una estación en el botón 3 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void tresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tresActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(3);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(3);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_tresActionPerformed

    /**
     * Método que permite guardar una estación en el botón 4 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void cuatroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuatroActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(4);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }   
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(4);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_cuatroActionPerformed

    /**
     * Método que permite guardar una estación en el botón 5 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void cincoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cincoActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(5);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(5);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_cincoActionPerformed

    /**
     * Método que permite guardar una estación en el botón 6 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void seisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seisActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(6);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(6);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_seisActionPerformed

    /**
     * Método que permite guardar una estación en el botón 7 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void sieteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sieteActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(7);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(7);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_sieteActionPerformed

    /**
     * Método que permite guardar una estación en el botón 9 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void nueveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nueveActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(9);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(9);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_nueveActionPerformed

    /**
     * Método que permite guardar una estación en el botón 10 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void diezActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_diezActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(10);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(10);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_diezActionPerformed

    /**
     * Método que permite guardar una estación en el botón 11 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void onceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onceActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(11);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(11);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_onceActionPerformed

    /**
     * Método que permite guardar una estación en el botón 12 o seleccionarla.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (this.guardar.isSelected()){
            this.radio.guardarEstacion(12);
            if (radio.isOn()){
                JOptionPane.showMessageDialog(null, "Estación guardada " + radio.getFrecuencia());
            }
        }
        if (this.seleccionar.isSelected()){
            this.radio.seleccionarEstacion(12);
            this.info.setText(this.mostInf());
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * Método que permite seleccionar la opcion de guardar una estación.
     * @param evt El evento que se da al seleccionar la opción.
     */
    private void guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guardarActionPerformed
        this.seleccionar.setSelected(false);
        this.guardar.setSelected(true);
    }//GEN-LAST:event_guardarActionPerformed

    /**
     * Método que permite seleccionar la opcion de guardar una estación.
     * @param evt El evento que se da al seleccionar la opción.
     */
    private void seleccionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seleccionarActionPerformed
        this.guardar.setSelected(false);
        this.seleccionar.setSelected(true);
    }//GEN-LAST:event_seleccionarActionPerformed

    /**
     * Método que permite cambiar de frecuencia. Esta va ascendiendo.
     * @param evt El evento que se da al cambiar la frecuencia.
     */
    private void masBandaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_masBandaActionPerformed
        this.radio.cambiarFrecuencia();
        this.info.setText(this.mostInf());
    }//GEN-LAST:event_masBandaActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(RadioGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(RadioGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(RadioGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(RadioGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new RadioGUI().setVisible(true);
            }
        });
    }
    
    //------------------------------------------------------------------------
    // Variables: 
    //------------------------------------------------------------------------
    
    //Se crea la variable que utilizará el radio.
    private Uso_Radio radio;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton am_fm;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JButton cinco;
    private javax.swing.JButton cuatro;
    private javax.swing.JButton diez;
    private javax.swing.JButton dos;
    private javax.swing.JLabel frecuencia;
    private javax.swing.JRadioButton guardar;
    private javax.swing.JTextArea info;
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton masBanda;
    private javax.swing.JButton nueve;
    private javax.swing.JButton ocho;
    private javax.swing.JButton on_off;
    private javax.swing.JButton once;
    private javax.swing.JButton seis;
    private javax.swing.JRadioButton seleccionar;
    private javax.swing.JButton siete;
    private javax.swing.JButton tres;
    private javax.swing.JButton uno;
    // End of variables declaration//GEN-END:variables
}
